<?php
include(getabspath("include/tbl_lien_he_settings.php"));

function DisplayMasterTableInfo_tbl_lien_he($params)
{
	$detailtable=$params["detailtable"];
	$keys=$params["keys"];
	global $conn,$strTableName;
	$xt = new Xtempl();
	
	$oldTableName=$strTableName;
	$strTableName="tbl_lien_he";

//$strSQL = "SELECT  id,  ten_vn,  ten_en,  dia_chi_vn,  dia_chi_en,  dien_thoai_vn,  dien_thoai_en,  email_vn,  email_en,  noi_dung_vn,  noi_dung_en  FROM tbl_lien_he  ";

$sqlHead="SELECT id,  ten_vn,  ten_en,  dia_chi_vn,  dia_chi_en,  dien_thoai_vn,  dien_thoai_en,  email_vn,  email_en,  noi_dung_vn,  noi_dung_en";
$sqlFrom="FROM tbl_lien_he";
$sqlWhere="";
$sqlTail="";

$where="";

if($detailtable=="tbl_fqas")
{
		$where.= GetFullFieldName("id")."=".make_db_value("id",$keys[1-1]);
}
if(!$where)
{
	$strTableName=$oldTableName;
	return;
}
	$str = SecuritySQL("Export");
	if(strlen($str))
		$where.=" and ".$str;
	
	$strWhere=whereAdd($sqlWhere,$where);
	if(strlen($strWhere))
		$strWhere=" where ".$strWhere." ";
	$strSQL= $sqlHead.' '.$sqlFrom.$strWhere.$sqlTail;

//	$strSQL=AddWhere($strSQL,$where);

	LogInfo($strSQL);
	$rs=db_query($strSQL,$conn);
	$data=db_fetch_array($rs);
	if(!$data)
	{
		$strTableName=$oldTableName;
		return;
	}
	$keylink="";
	$keylink.="&key1=".htmlspecialchars(rawurlencode(@$data["id"]));
	


//	ten_vn - 
			$value="";
				$value = ProcessLargeText(GetData($data,"ten_vn", ""),"field=ten%5Fvn".$keylink,"",MODE_PRINT);
			$xt->assign("ten_vn_mastervalue",$value);

//	ten_en - 
			$value="";
				$value = ProcessLargeText(GetData($data,"ten_en", ""),"field=ten%5Fen".$keylink,"",MODE_PRINT);
			$xt->assign("ten_en_mastervalue",$value);

//	dia_chi_vn - 
			$value="";
				$value = ProcessLargeText(GetData($data,"dia_chi_vn", ""),"field=dia%5Fchi%5Fvn".$keylink,"",MODE_PRINT);
			$xt->assign("dia_chi_vn_mastervalue",$value);

//	dia_chi_en - 
			$value="";
				$value = ProcessLargeText(GetData($data,"dia_chi_en", ""),"field=dia%5Fchi%5Fen".$keylink,"",MODE_PRINT);
			$xt->assign("dia_chi_en_mastervalue",$value);

//	dien_thoai_vn - 
			$value="";
				$value = ProcessLargeText(GetData($data,"dien_thoai_vn", ""),"field=dien%5Fthoai%5Fvn".$keylink,"",MODE_PRINT);
			$xt->assign("dien_thoai_vn_mastervalue",$value);

//	dien_thoai_en - 
			$value="";
				$value = ProcessLargeText(GetData($data,"dien_thoai_en", ""),"field=dien%5Fthoai%5Fen".$keylink,"",MODE_PRINT);
			$xt->assign("dien_thoai_en_mastervalue",$value);

//	email_vn - 
			$value="";
				$value = ProcessLargeText(GetData($data,"email_vn", ""),"field=email%5Fvn".$keylink,"",MODE_PRINT);
			$xt->assign("email_vn_mastervalue",$value);

//	email_en - 
			$value="";
				$value = ProcessLargeText(GetData($data,"email_en", ""),"field=email%5Fen".$keylink,"",MODE_PRINT);
			$xt->assign("email_en_mastervalue",$value);

//	noi_dung_vn - Custom
			$value="";
				$value = GetData($data,"noi_dung_vn", "Custom");
			$xt->assign("noi_dung_vn_mastervalue",$value);

//	noi_dung_en - Custom
			$value="";
				$value = GetData($data,"noi_dung_en", "Custom");
			$xt->assign("noi_dung_en_mastervalue",$value);
	$xt->display("tbl_lien_he_masterprint.htm");
	$strTableName=$oldTableName;

}

?>